# -*-encoding: utf-8 -*-

import pg

try:
    pgdb_conn = pg.connect(dbname = 'pgdb', host = '192.168.2.138', user = 'postgres', passwd = 'postgres')
except Exception, e:
    print e.args[0]

sql_select = '''
	select * from component
	'''

sql_insert = "INSERT INTO component(component_name) values('apple1a1a11111111111111111111111111111111111111111111111111111111111111111111')"
sql_delete = '''
	DELETE FROM component WHERE component_name = '2' OR component_name = '3';
'''

query_select = pgdb_conn.query(sql_select)
query_insert = pgdb_conn.query(sql_insert)
query_delete = pgdb_conn.query(sql_delete)

for row in query_select.dictresult():
    print row

print query_insert

print query_delete
